Fix duplicate SummarizationMiddleware error#30
Conversation
create_deep_agent already adds SummarizationMiddleware when checkpointer is enabled. Remove manual addition to avoid duplicate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR removes the manual SummarizationMiddleware configuration in RefactorAgent to avoid a runtime error caused by duplicate middleware instances, relying instead on create_deep_agent’s automatic middleware handling when a checkpointer is enabled.
Changes:
- Removed explicit
SummarizationMiddlewareinstantiation from agent initialization. - Updated agent initialization to pass no custom middleware.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # middleware 由 create_deep_agent 在啟用 checkpointer 時自動管理 | ||
| middleware = [] | ||
|
|
There was a problem hiding this comment.
With middleware now always set to an empty list, the SummarizationMiddleware import becomes unused, and the later middleware=middleware if middleware else None will always pass None. Please remove the unused import and consider dropping the middleware local/argument entirely (or pass middleware=None directly) for clarity.
Summary
SummarizationMiddlewareaddition that causedPlease remove duplicate middleware instanceserrorcreate_deep_agentalready adds it automatically whencheckpointeris enabledTest plan
🤖 Generated with Claude Code